#include <stdio.h>    /*预处理*/
#include <math.h>

int main()
{
    int number1,number2;    /*定义变量*/
    char op;
    printf("Please input formula:");
    scanf("%d %c%d",&number1,&op,&number2);  /*输入数值，在%c之前加入空格保证输入的数值之间可以有任意个空格*/
    switch (op)      /*选择语句*/
    {
        case '+':    /*开始讨论各种情况*/
        printf("%d",number1+number2);
        break;       /*注意每种情况需要加入break语句，否则会一直执行不会停止*/

        case '-':
        printf("%d",number1-number2);
        break;

        case '*':
        printf("%d",number1*number2);
        break;

        case '/':
        if(fabs(number2-0)<=1e-7)    /*防止数据在存储过程当中出现数据失真，不用==*/
        {
            printf("The divisor cannnot be zero");
        }
        else
        {
            printf("%d",number1/number2);
        }
        break;

        case '%':
        if(fabs(number2-0)<=1e-7)
        {
            printf("The divisor cannnot be zero");
        }
        else
        {
            printf("%d",number1%number2);
        }
        break;

        default:    /*考虑其他情况*/
        printf("ERROR");
        break;
    }
    return 0;
}